#include "Client.h"

Client::Client() : pSocket()
{
}

void Client::Connect(const char * sIPaddr, int nPort)
{
	unsigned long addr = inet_addr(sIPaddr);
	if(addr == INADDR_NONE)
		throw INADDR_NONE;
	sockaddr_in address;
	address.sin_family = AF_INET;
	address.sin_port = htons(nPort);
	address.sin_addr.S_un.S_addr = addr;
	if(connect(_baseSocket, (sockaddr *)&address, sizeof(sockaddr_in)) == SOCKET_ERROR)
		throw SOCKET_ERROR;
}

int Client::Receive(const int nBytes)
{
	return pSocket::Receive(_recvBuffer, NULL, nBytes);
}